/ MacWorld 1997 September
/ Macworld (1997-09).dmg / Serious Software / Cherwell Scientific Demos / pro Fit / pro Fit 5.0 demo (68k).sea / pro Fit 5.0 demo (68k) / Examples / Programming - intro / function - with derivatives ![]() | < prev | next > |
MacBinary | 1996-04-15 | 2.3 KB | [ftFC/NLft] |
Confidence | Program | Detection | Match Type | Support |
---|---|---|---|---|
10% | dexvert | MacBinary (archive/macBinary) | fallback | Supported |
100% | file | MacBinary II, inited, Mon Apr 15 11:12:44 1996, modified Mon Apr 15 11:12:44 1996, creator 'NLft', type 'ftFC', 1171 bytes "function - with derivatives" , at 0x513 815 bytes resource | default (weak) | |
99% | file | data | default | |
100% | TrID | MacBinary 2 | default (weak) | |
100% | siegfried | fmt/1762 MacBinary (II) | default | |
100% | lsar | MacBinary | default |
id metadata | |
---|---|
key | value |
macFileType | [ftFC] |
macFileCreator | [NLft] |
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 1b 66 75 6e 63 74 69 | 6f 6e 20 2d 20 77 69 74 |..functi|on - wit|
|00000010| 68 20 64 65 72 69 76 61 | 74 69 76 65 73 00 00 00 |h deriva|tives...|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 66 74 46 43 4e 4c 66 | 74 01 00 00 00 00 00 00 |.ftFCNLf|t.......|
|00000050| 00 00 00 00 00 04 93 00 | 00 03 2f ad 98 17 ec ad |........|../.....|
|00000060| 98 17 ec 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 52 1f 00 00 |........|....R...|
|00000080| 7b 20 09 54 68 65 20 66 | 6f 6c 6c 6f 77 69 6e 67 |{ .The f|ollowing|
|00000090| 20 66 75 6e 63 74 69 6f | 6e 20 64 65 66 69 6e 65 | functio|n define|
|000000a0| 73 20 74 68 65 20 68 79 | 70 65 72 62 6f 6c 69 63 |s the hy|perbolic|
|000000b0| 20 73 69 6e 65 2e 0d 20 | 20 20 49 74 20 73 68 6f | sine.. | It sho|
|000000c0| 77 73 20 74 68 65 20 75 | 73 65 20 6f 66 20 74 68 |ws the u|se of th|
|000000d0| 65 20 70 72 6f 63 65 64 | 75 72 65 20 44 65 72 69 |e proced|ure Deri|
|000000e0| 76 61 74 69 76 65 73 20 | 74 6f 20 63 61 6c 63 75 |vatives |to calcu|
|000000f0| 6c 61 74 65 0d 20 20 20 | 74 68 65 20 6e 75 6d 65 |late. |the nume|
|00000100| 72 69 63 61 6c 20 64 65 | 72 69 76 61 74 69 76 65 |rical de|rivative|
|00000110| 73 20 6f 66 20 61 20 66 | 75 6e 63 74 69 6f 6e 20 |s of a f|unction |
|00000120| 77 69 74 68 20 72 65 73 | 70 65 63 74 20 74 6f 20 |with res|pect to |
|00000130| 69 74 73 0d 20 20 20 70 | 61 72 61 6d 65 74 65 72 |its. p|arameter|
|00000140| 73 20 28 b6 66 2f b6 61 | 69 29 2e 0d 20 20 20 54 |s (.f/.a|i).. T|
|00000150| 68 65 20 64 65 66 69 6e | 69 74 69 6f 6e 20 6f 66 |he defin|ition of|
|00000160| 20 74 68 65 20 70 72 6f | 63 65 64 75 72 65 20 44 | the pro|cedure D|
|00000170| 65 72 69 76 61 74 69 76 | 65 73 20 69 73 20 6f 70 |erivativ|es is op|
|00000180| 74 69 6f 6e 61 6c 2e 20 | 49 74 20 69 73 20 6f 6e |tional. |It is on|
|00000190| 6c 79 0d 20 20 20 75 73 | 65 64 20 66 6f 72 20 66 |ly. us|ed for f|
|000001a0| 69 74 74 69 6e 67 20 61 | 20 66 75 6e 63 74 69 6f |itting a| functio|
|000001b0| 6e 20 77 69 74 68 20 74 | 68 65 20 27 4e 6f 6e 6c |n with t|he 'Nonl|
|000001c0| 69 6e 65 61 72 20 46 69 | 74 27 20 63 6f 6d 6d 61 |inear Fi|t' comma|
|000001d0| 6e 64 2e 0d 20 20 20 49 | 66 20 79 6f 75 20 64 6f |nd.. I|f you do|
|000001e0| 6e 27 74 20 77 61 6e 74 | 20 74 6f 20 64 65 66 69 |n't want| to defi|
|000001f0| 6e 65 20 44 65 72 69 76 | 61 74 69 76 65 73 2c 20 |ne Deriv|atives, |
|00000200| 74 68 65 20 76 61 6c 75 | 65 73 20 6f 66 20 b6 66 |the valu|es of .f|
|00000210| 2f b6 61 69 20 77 69 6c | 6c 0d 20 20 20 62 65 20 |/.ai wil|l. be |
|00000220| 63 61 6c 63 75 6c 61 74 | 65 64 20 6e 75 6d 65 72 |calculat|ed numer|
|00000230| 69 63 61 6c 6c 79 2e 20 | 48 6f 77 65 76 65 72 2c |ically. |However,|
|00000240| 20 74 68 69 73 20 77 69 | 6c 6c 20 6d 61 6b 65 20 | this wi|ll make |
|00000250| 66 69 74 74 69 6e 67 0d | 20 20 20 73 6c 6f 77 65 |fitting.| slowe|
|00000260| 72 2e 20 0d 7d 0d 20 20 | 20 0d 0d 0d 66 75 6e 63 |r. .}. | ...func|
|00000270| 74 69 6f 6e 20 4d 79 53 | 69 6e 68 3b 0d 76 61 72 |tion MyS|inh;.var|
|00000280| 20 74 3a 20 72 65 61 6c | 3b 0d 0d 20 20 70 72 6f | t: real|;.. pro|
|00000290| 63 65 64 75 72 65 20 44 | 65 72 69 76 61 74 69 76 |cedure D|erivativ|
|000002a0| 65 73 3b 0d 20 20 20 20 | 7b 20 54 68 69 73 20 70 |es;. |{ This p|
|000002b0| 72 6f 63 65 64 75 72 65 | 20 72 65 74 75 72 6e 73 |rocedure| returns|
|000002c0| 20 74 68 65 20 70 61 72 | 74 69 61 6c 20 64 65 72 | the par|tial der|
|000002d0| 69 76 61 74 69 76 65 73 | 20 6f 66 20 74 68 65 20 |ivatives| of the |
|000002e0| 66 75 6e 63 74 69 6f 6e | 0d 20 20 20 20 20 20 77 |function|. w|
|000002f0| 69 74 68 20 72 65 73 70 | 65 63 74 20 74 6f 20 69 |ith resp|ect to i|
|00000300| 74 73 20 70 61 72 61 6d | 65 74 65 72 73 2e 20 49 |ts param|eters. I|
|00000310| 6e 20 74 68 69 73 20 65 | 78 61 6d 70 6c 65 20 69 |n this e|xample i|
|00000320| 74 20 72 65 74 75 72 6e | 73 0d 20 20 20 20 20 20 |t return|s. |
|00000330| 61 20 76 61 6c 75 65 20 | 74 68 61 74 20 77 61 73 |a value |that was|
|00000340| 20 63 61 6c 63 75 6c 61 | 74 65 64 20 69 6e 20 74 | calcula|ted in t|
|00000350| 68 65 20 6d 61 69 6e 20 | 70 61 72 74 20 6f 66 20 |he main |part of |
|00000360| 74 68 65 20 66 75 6e 63 | 74 69 6f 6e 0d 20 20 20 |the func|tion. |
|00000370| 20 20 20 74 6f 20 6d 61 | 6b 65 20 69 74 73 20 65 | to ma|ke its e|
|00000380| 78 65 63 75 74 69 6f 6e | 20 66 61 73 74 65 72 2e |xecution| faster.|
|00000390| 20 54 68 69 73 20 69 73 | 20 70 6f 73 73 69 62 6c | This is| possibl|
|000003a0| 65 20 62 65 63 61 75 73 | 65 20 74 68 65 20 6d 61 |e becaus|e the ma|
|000003b0| 69 6e 20 0d 20 20 20 20 | 20 20 70 61 72 74 20 69 |in . | part i|
|000003c0| 73 20 62 65 20 63 61 6c | 6c 65 64 20 66 6f 72 20 |s be cal|led for |
|000003d0| 65 61 63 68 20 78 2d 76 | 61 6c 75 65 20 62 65 66 |each x-v|alue bef|
|000003e0| 6f 72 65 20 64 65 72 69 | 76 61 74 69 76 65 73 0d |ore deri|vatives.|
|000003f0| 20 20 20 20 20 20 69 73 | 20 63 61 6c 6c 65 64 2e | is| called.|
|00000400| 0d 20 20 20 20 20 20 48 | 6f 77 65 76 65 72 2c 20 |. H|owever, |
|00000410| 69 66 20 79 6f 75 20 64 | 6f 6e 27 74 20 77 61 6e |if you d|on't wan|
|00000420| 74 20 74 6f 20 75 73 65 | 20 61 20 74 65 6d 70 6f |t to use| a tempo|
|00000430| 72 61 72 79 20 76 61 72 | 69 61 62 6c 65 2c 20 79 |rary var|iable, y|
|00000440| 6f 75 0d 20 20 20 20 20 | 20 6a 75 73 74 20 61 73 |ou. | just as|
|00000450| 20 77 65 6c 6c 20 63 6f | 75 6c 64 20 77 72 69 74 | well co|uld writ|
|00000460| 65 3a 20 64 79 64 61 5b | 31 5d 20 3a 3d 20 73 69 |e: dyda[|1] := si|
|00000470| 6e 68 28 78 29 2e 20 7d | 0d 20 20 62 65 67 69 6e |nh(x). }|. begin|
|00000480| 0d 20 20 20 20 64 79 64 | 61 5b 31 5d 20 3a 3d 20 |. dyd|a[1] := |
|00000490| 74 3b 20 20 7b 20 b6 66 | 2f b6 61 31 20 3d 20 73 |t; { .f|/.a1 = s|
|000004a0| 69 6e 68 28 78 29 20 7d | 0d 20 20 65 6e 64 3b 0d |inh(x) }|. end;.|
|000004b0| 0d 62 65 67 69 6e 09 09 | 09 09 20 20 20 20 20 20 |.begin..|.. |
|000004c0| 20 7b 74 68 65 20 6d 61 | 69 6e 20 70 61 72 74 7d | {the ma|in part}|
|000004d0| 0d 20 20 74 20 3a 3d 20 | 73 69 6e 68 28 78 29 3b |. t := |sinh(x);|
|000004e0| 09 7b 73 61 76 65 20 73 | 69 6e 68 20 66 6f 72 20 |.{save s|inh for |
|000004f0| 64 65 72 69 76 61 74 69 | 76 65 73 7d 0d 20 20 79 |derivati|ves}. y|
|00000500| 20 3a 3d 20 61 5b 31 5d | 20 2a 20 74 3b 0d 65 6e | := a[1]| * t;.en|
|00000510| 64 3b 0d 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |d;......|........|
|00000520| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000530| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000540| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000550| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000560| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000570| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000580| 00 00 01 00 00 00 02 b9 | 00 00 01 b9 00 00 00 76 |........|.......v|
|00000590| 20 66 75 6e 63 74 69 6f | 6e 20 64 65 66 69 6e 65 | functio|n define|
|000005a0| 73 20 74 68 65 20 68 79 | 70 65 72 62 6f 6c 69 63 |s the hy|perbolic|
|000005b0| 1b 66 75 6e 63 74 69 6f | 6e 20 2d 20 77 69 74 68 |.functio|n - with|
|000005c0| 20 64 65 72 69 76 61 74 | 69 76 65 73 02 00 00 00 | derivat|ives....|
|000005d0| 00 00 66 74 46 43 4e 4c | 66 74 01 00 ff ff ff ff |..ftFCNL|ft......|
|000005e0| 00 00 00 00 00 00 00 00 | 00 00 80 00 00 00 00 00 |........|........|
|000005f0| 00 00 a5 0a 49 b6 00 00 | 04 93 00 00 03 2f 6d 65 |....I...|...../me|
|00000600| 72 69 63 61 6c 20 64 65 | 72 69 76 61 74 69 76 65 |rical de|rivative|
|00000610| 73 20 6f 66 20 61 20 66 | 75 6e 63 74 69 6f 6e 20 |s of a f|unction |
|00000620| 77 69 74 68 20 72 65 73 | 70 65 63 74 20 74 6f 20 |with res|pect to |
|00000630| 69 74 73 0d 20 20 20 70 | 61 72 61 6d 65 74 65 72 |its. p|arameter|
|00000640| 73 20 28 b6 66 2f b6 61 | 69 29 2e 0d 20 20 20 54 |s (.f/.a|i).. T|
|00000650| 68 65 20 64 65 66 69 6e | 69 74 69 6f 6e 20 6f 66 |he defin|ition of|
|00000660| 20 74 68 65 20 70 72 6f | 63 65 64 75 72 65 20 44 | the pro|cedure D|
|00000670| 65 72 69 76 61 74 69 76 | 65 73 20 69 73 20 6f 70 |erivativ|es is op|
|00000680| 00 00 00 08 00 3c 00 05 | 02 5c 02 1d 00 00 01 06 |.....<..|.\......|
|00000690| 00 04 00 09 00 00 06 4d | 6f 6e 61 63 6f 80 02 63 |.......M|onaco..c|
|000006a0| 04 00 00 00 2d e8 02 87 | f7 70 22 00 02 28 40 a1 |....-...|.p"..(@.|
|000006b0| 27 a0 00 4f b3 00 00 81 | 00 00 00 01 d9 94 00 0b |'..O....|........|
|000006c0| 00 06 00 0b 00 06 00 00 | 00 81 02 62 75 40 00 00 |........|...bu@..|
|000006d0| 00 00 02 62 6b 04 00 00 | 00 81 02 62 75 40 00 00 |...bk...|...bu@..|
|000006e0| 00 00 ff ff ff ff 02 87 | f8 c0 02 62 5f 3c 03 22 |........|...b_<."|
|000006f0| 67 78 02 62 65 9e 02 62 | 64 e8 02 62 0d 80 02 87 |gx.be..b|d..b....|
|00000700| f7 a8 00 00 00 00 02 87 | f8 a8 00 00 63 20 00 00 |........|....c ..|
|00000710| 01 ea 00 00 01 1d 00 00 | 00 00 00 00 01 0d 00 00 |........|........|
|00000720| 01 da 00 00 00 00 02 87 | f8 20 24 08 02 82 00 14 |........|. $.....|
|00000730| d3 44 00 19 5a 90 02 87 | f8 20 00 18 bc 8c 00 14 |.D..Z...|. ......|
|00000740| cb 14 00 00 63 20 02 87 | f8 20 00 18 bc 8c 00 1a |....c ..|. ......|
|00000750| 8f 0c 00 1a 8f 00 02 87 | f8 50 00 18 bc 8c 01 db |........|.P......|
|00000760| 01 0e 01 db 01 0e 02 87 | f8 30 00 1a 8f 24 00 1a |........|.0...$..|
|00000770| f2 94 00 0c f4 a0 00 01 | ee 50 00 01 2f a4 00 00 |........|.P../...|
|00000780| 00 00 00 0c f4 d0 02 62 | 88 a2 00 19 5a 70 07 80 |.......b|....Zp..|
|00000790| 03 80 00 00 00 00 00 00 | 00 10 00 00 00 00 00 00 |........|........|
|000007a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 04 00 00 |........|........|
|000007b0| 00 01 00 00 00 78 00 03 | 00 00 00 48 00 48 00 00 |.....x..|...H.H..|
|000007c0| 00 00 02 da 02 28 ff e1 | ff e2 02 f9 02 46 03 47 |.....(..|.....F.G|
|000007d0| 05 28 03 fc 00 02 00 00 | 00 48 00 48 00 00 00 00 |.(......|.H.H....|
|000007e0| 02 da 02 28 00 01 00 00 | 00 64 00 00 00 01 00 01 |...(....|.d......|
|000007f0| 01 01 00 00 00 01 27 0f | 00 01 00 01 00 00 00 00 |......'.|........|
|00000800| 00 00 00 00 00 00 00 00 | 00 02 00 19 01 90 00 00 |........|........|
|00000810| 00 00 00 40 00 00 00 00 | 00 00 00 00 00 01 00 00 |...@....|........|
|00000820| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000830| 00 07 06 70 72 6f 46 69 | 74 00 00 01 00 00 00 02 |...proFi|t.......|
|00000840| b9 00 00 01 b9 00 00 00 | 76 02 62 9b fc 22 e4 00 |........|v.b.."..|
|00000850| 00 00 1c 00 76 00 01 66 | 49 4e 46 00 04 00 12 53 |....v..f|INF....S|
|00000860| 54 52 20 00 00 00 4e 00 | 81 ff ff 00 00 00 00 02 |TR ...N.|........|
|00000870| 62 93 98 00 82 ff ff 00 | 00 00 0c 02 62 96 0c 00 |b.......|....b...|
|00000880| 83 ff ff 00 00 01 16 02 | 62 96 04 00 85 ff ff 00 |........|b.......|
|00000890| 00 01 2a 02 62 92 ac 00 | 84 ff ff 00 00 01 32 02 |..*.b...|......2.|
|000008a0| 62 96 28 bf f4 ff ff 00 | 00 01 ae 02 62 93 8c 00 |b.(.....|....b...|
|000008b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000008c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000008d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000008e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000008f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+